package com.china08.yxyapi.repository.mg.homework;

import java.util.List;

import org.springframework.data.mongodb.repository.MongoRepository;

import com.china08.yxyapi.entity.mg.homework.HomeworkKnowReport;
import com.china08.yxyapi.entity.mg.homework.HomeworkTaskReportQues;

/**
 * 作业:任务:报告:查看分析
 * 
 * @author yangyunying
 *
 */
public interface HomeworkTaskReportQuesRepository extends MongoRepository<HomeworkTaskReportQues, String> {

    HomeworkTaskReportQues findById(String id);

    /**
     * 通过班级id，知识点id查询
     * 
     * @param classId
     *            班级id
     * @param knowIdLst
     *            知识点id
     * @return
     */
    List<HomeworkKnowReport> findByClassIdAndKnowIdLst(String classId, List<Integer> knowIdLst);

    /**
     * 通过学生id，知识点id查询
     * 
     * @param taskId
     * @param studentId
     * @param taskName
     * @return
     */
    List<HomeworkKnowReport> findByStudentIdAndKnowIdLst(String StudentId, List<Integer> knowIdLst);

    /**
     * 通过学生id查询已经做过的试题类
     * 
     * @param studentId
     * @param passed
     * @return
     */
    List<HomeworkTaskReportQues> findByStudentId(String studentId);

    /**
     * 
     * @param taskId
     * @param classIds
     * @return
     */
    List<HomeworkTaskReportQues> findByTaskIdAndQuestionTypeAndStudentIdIn(String taskId, String questionType,
            List<String> classIds);

    List<HomeworkTaskReportQues> findByTaskIdAndQuestionTypeInAndStudentIdIn(String taskId, List<String> questionType,
            List<String> classIds);

    /**
     * 
     * @param taskId
     * @param classIds
     * @return
     */
    List<HomeworkTaskReportQues> findByTaskIdAndQuestionTypeAndClassId(String taskId, String string, String classId);

    /**
     * 通过学生id查询已经做过的试题类
     * 
     * @param studentId
     * @param passed
     * @return
     */
    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdOrderByOrderAsc(String taskId, String studentId);

    /**
     * 根据学生ID和试题ID查询学生答题记录
     * 
     * @param studentId
     * @param quesId
     * @return
     */
    HomeworkTaskReportQues findByStudentIdAndQuesId(String studentId, String quesId);

    /**
     * 根据学生id和任务id查出该学生在当前任务下的所有答题记录 2017年3月11日14:24:51
     * 
     * @param studentId
     * @param taskId
     * @return
     */
    List<HomeworkTaskReportQues> findByStudentIdAndTaskId(String studentId, String taskId);

    List<HomeworkTaskReportQues> findByStudentIdAndTaskIdAndClassId(String studentId, String taskId, String classId);

    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndPassed(String studentId, String taskId, Integer passed);

    /**
     * 根据学生ID和任务ID查询当前任务的题的总数 2017年3月16日16:09:49
     * 
     * @param studentId
     * @param taskId
     * @return
     */
    Long countByStudentIdAndTaskId(String studentId, String taskId);

    /**
     * 根据学生ID和任务ID和题的类型查询当前任务下的该类型的题的总数 2017年3月16日16:09:46
     * 
     * @param studentId
     * @param taskId
     * @param string
     * @return
     */
    Long countByStudentIdAndTaskIdAndQuestionType(String studentId, String taskId, String string);

    /**
     * 根据学生ID和任务ID和题的类型和是否正确查询当前任务下的该类型的正确的题的总数 2017年3月16日16:15:26
     * 
     * @param studentId
     * @param taskId
     * @param string
     * @param i
     * @return
     */
    Long countByStudentIdAndTaskIdAndQuestionTypeAndPassed(String studentId, String taskId, String string, int i);

    /**
     * 通过学生id和是否正确字段查出数据
     * 
     * @param studentId
     *            学生id
     * @param passed
     *            是否正确
     * @return
     */
    Integer countByStudentIdAndPassed(String studentId, Integer passed);

    /**
     * 通过学生id,任务id,试题类型查出已经答了多少题
     * 
     * @param studentId
     *            学生id
     * @param passed
     *            是否正确
     * @return
     */
    Integer countByStudentId(String studentId);

    /**
     * 通过学生id,任务id,试题类型,是否是错题查出已经答了多少题
     * 
     * @param studentId
     *            学生id
     * @param passed
     *            是否正确
     * @return
     */
    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndQuestionTypeAndPassed(String taskId, String studentId,
            String string, Integer passed);

    List<HomeworkTaskReportQues> findByStudentIdAndTaskIdAndQuestionType(String studentId, String taskId,
            String questionType);

    /**
     * 通过学生id和任务id，还有试题类型去查询记录并且根据序号进行排序
     * 
     * @param studentId
     *            学生id
     * @param taskId
     *            任务id
     * @param questionType
     *            试题类型
     * @return
     */
    List<HomeworkTaskReportQues> findByStudentIdAndTaskIdAndQuestionTypeNotInOrderByOrder(String studentId,
            String taskId, String string);

    /**
     * 通过学生id和任务id，试题类型查询记录
     * 
     * @param studentId
     * @param taskId
     * @param string
     * @return
     */
    List<HomeworkTaskReportQues> findByStudentIdAndTaskIdAndQuestionTypeNotIn(String studentId, String taskId,
            String questionTypeNotin);

    /**
     * 通过任务id，试题类型查询记录
     * 
     * @param studentId
     * @param taskId
     * @param string
     * @return
     */
    List<HomeworkTaskReportQues> findByTaskIdAndQuestionTypeNotInOrderByOrder(String taskId, String questionType);

    /**
     * 通过任务id，学生id，试题类型，试题id去查询记录并且根据试题序号排序
     * 
     * @param studentId
     * @param taskId
     * @param quesId
     * @param questionType
     * @return
     */
    HomeworkTaskReportQues findByStudentIdAndTaskIdAndQuesIdAndQuestionTypeNotInOrderByOrder(String studentId,
            String taskId, String quesId, String questionType);

    /**
     * 通过学生Id列表，任务Id，试题类型 获取学生答题
     * 
     * @param studentIds
     *            学生列表
     * @param taskId
     *            任务Id
     * @param questionType
     *            0-选择题，1-填空题，2-通知类试题
     * @return
     */
    List<HomeworkTaskReportQues> findByStudentIdInAndTaskIdAndQuestionType(List<String> studentIds, String taskId,
            String questionType);

    /**
     * 通过学生ID 任务ID 和问题ID查询是否已经答题
     * 
     * @param studentId
     * @param taskId
     * @param quesId
     * @return
     */
    HomeworkTaskReportQues findByStudentIdAndTaskIdAndQuesId(String studentId, String taskId, String quesId);

    /**
     * 通过学生id，任务id，试题id，题号，试题类型不包含哪个类型的时候查出的记录
     * 
     * @param studentId
     * @param taskId
     * @param quesId
     * @param order
     * @param string
     * @return
     */
    HomeworkTaskReportQues findByStudentIdAndTaskIdAndQuesIdAndOrderAndQuestionTypeNotIn(String studentId,
            String taskId, String quesId, Integer order, String string);

    /**
     * 通过学生id,任务id,试题类型,是否是错题查出已经答了多少题
     * 
     * @param taskId
     * @param studentId
     * @param questionType
     * @param i
     * @return
     */
    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndQuestionTypeInAndPassed(String taskId, String studentId,
            String[] questionType, int i);

    /**
     * 通过学生id,任务id,试题类型查出已经答了多少题
     * 
     * @param studentId
     * @param taskId
     * @param questionType
     * @return
     */
    List<HomeworkTaskReportQues> findByStudentIdAndTaskIdAndQuestionTypeIn(String studentId, String taskId,
            String[] questionType);

    List<HomeworkTaskReportQues> findByClassIdAndStudentIdAndTaskIdAndQuestionTypeIn(String classId, String studentId,
            String taskId, String[] questionType);

    List<HomeworkTaskReportQues> findByClassIdAndStudentIdInAndTaskIdInAndQuestionType(String classId,
            List<String> studentIds, List<String> taskIds, String questionType);

    List<HomeworkTaskReportQues> findByClassIdAndStudentIdAndTaskIdAndQuestionTypeInOrderByOrder(String classId,
            String studentId, String taskId, String[] questionType);

    List<HomeworkTaskReportQues> findByClassIdAndStudentIdAndTaskIdAndQuestionTypeIn(String classId, String studentId,
            String taskId, List<String> questionType);

    Integer countByClassIdAndStudentIdAndTaskIdAndQuestionTypeAndNotifyPassedNot(String classId, String studentId,
            String taskId, String questionType, Integer notifyPassed);

    Integer countByClassIdAndStudentIdAndTaskIdAndQuestionTypeAndMarkNot(String classId, String studentId,
            String taskId, String questionType, Integer notifyPassed);

    Integer countByClassIdAndStudentIdAndTaskIdAndQuestionTypeNotInAndMarkNot(String classId, String studentId,
            String taskId, List<String> questionType, Integer mark);

    Integer countByClassIdAndStudentIdAndTaskIdAndQuestionTypeInAndMarkNot(String classId, String studentId,
            String taskId, List<String> questionType, Integer mark);

    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndQuestionTypeInAndPassedAndAnswerOfMyNot(String taskId,
            String studentId, String[] questionType, int i, Object object);

    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndPassedOrderByOrder(String taskId, String studentId, int i);

    List<HomeworkTaskReportQues> findByStudentIdAndTaskIdOrderByOrder(String studentId, String taskId);

    Integer countByTaskIdAndAndQuestionTypeInAndPassedAndStudentId(String taskId, List<String> questionTypes,
            int passed, String studentId);

    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndPassedAndMarkNotOrderByOrder(String taskId,
            String studentId, int i, int j);

    List<HomeworkTaskReportQues> findByTaskIdAndStudentIdAndQuestionTypeInAndPassedAndMarkNot(String taskId,
            String studentId, String[] questionType, int passed, int mark);

    List<HomeworkTaskReportQues> findByTaskIdAndClassId(String taskId, String classId);

    List<HomeworkTaskReportQues> findByTaskIdAndClassIdAndQuesId(String taskId, String classId, String quesId);

    List<HomeworkTaskReportQues> findByQuestionTypeAndMarkAndNotifyPassedNot(String string, int i, int j);

    List<HomeworkTaskReportQues> findByQuestionType(String string);

}
